﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DeviceInterface.cs" company="Matthias Friedrich">
//   Copyright © Matthias Friedrich 2009
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace DeviceManagement
{
	using System;

	public class DeviceInterface
	{
		private readonly Guid deviceInterfaceClassGuid;

		private DEV_BROADCAST_DEVICEINTERFACE deviceInterface = DEV_BROADCAST_DEVICEINTERFACE.Empty;

		public DeviceInterface(Guid deviceInterfaceClassGuid)
		{
			this.deviceInterfaceClassGuid = deviceInterfaceClassGuid;
		}

		internal DeviceInterface(DEV_BROADCAST_DEVICEINTERFACE deviceInterface)
		{
			this.deviceInterfaceClassGuid = deviceInterface.dbcc_classguid;
			this.deviceInterface = deviceInterface;
		}

		public Guid ClassGuid
		{
			get
			{
				return this.deviceInterfaceClassGuid;
			}
		}

		public string Name
		{
			get
			{
				if (!DEV_BROADCAST_DEVICEINTERFACE.Empty.Equals(this.deviceInterface))
				{
					return this.deviceInterface.dbcc_name;
				}

				return null;
			}
		}

		public DeviceInfoSet GetDeviceInfoSet()
		{
			return DeviceInfoSet.GetPresent(this);
		}
	}
}